package com;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

//@Configuration让Spring来加载该类配置
//@Configuration
//@EnableSwagger2注解来启用Swagger2
@EnableSwagger2
@ComponentScan(basePackages = "com.controller")
@EnableWebMvc
public class SwaggerConfig {
    @Bean
    public Docket buildDocket(){
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(buildApiInf())
                .select()
                .paths(PathSelectors.any())
                .build();
    }
    private ApiInfo buildApiInf(){
        return new ApiInfoBuilder()
                .title("Swagger_崔")
                .termsOfServiceUrl("http://blog.csdn.net/u014231523网址链接")
                .description("我可以微笑着听你说你们的故事,但真的打不起笑脸听你说你们的关系。")
                .contact(new Contact("cuijunbo", "http://baidu.com", "345226159@qq.com"))
                .build();
    }
}
